package apiexample.transform.descriptionextraction;

import java.util.ArrayList;

import apiexample.transform.datastructure.UsageExample;

import com.apiexample.server.entity.DescriptionEntity;

import dao.entity.SegmentEntity;

/**
 * Given an code snippet, extract descriptions from its surrounding texts in the original web page
 * 
 * @author lijiejacy
 * 
 */
public interface DescriptionExtraction {
	/**
	 * Given a code snippet, extract descriptions from texts preceding it
	 * @param segments content segments of the original web page
	 * @param example usage example recording the structural information used for extraction
	 * @param indexOfCode index of code snippet in the original web page
	 * @param maxLen maximum length of descriptions
	 * @return a list of content segments
	 */
	public ArrayList<DescriptionEntity> getPrecedingDescriptionsOfCode(ArrayList<SegmentEntity> segments,
			UsageExample example, int indexOfCode, int maxLen);
	/**
	 * Given a code snippet, extract descriptions from texts following it
	 * @param segments content segments of the original web page
	 * @param example usage example recording the structural information used for extraction
	 * @param indexOfCode index of code snippet in the original web page
	 * @param maxLen maximum length of descriptions
	 * @return a list of content segments
	 */
	public ArrayList<DescriptionEntity> getFollowingDescriptionsOfCode(ArrayList<SegmentEntity> segments,
			UsageExample example, int indexOfCode, int maxLen);
}
